export const ldmessage = {
    success(text) {
        // if (document.querySelector(".ld-message-success"))
        //     return;
        const oSuccess = document.createElement('div')
        document.body.appendChild(oSuccess)
        oSuccess.className = "ld-message ld-success"
        oSuccess.innerHTML = `<i class="iconfont icon-chenggong"></i><span></span>`
        oSuccess.children[1].innerText = text
        setTimeout(() => {
            oSuccess.style.top = '24px'
        }, 50);
        setTimeout(() => {
            oSuccess.style.opacity = 0
            document.body.removeChild(oSuccess)
        }, 3000);
    },
    alert(text) {
        // if (document.querySelector(".ld-message-alert"))
        //     return;
        const oAlert = document.createElement('div')
        document.body.appendChild(oAlert)
        oAlert.className = "ld-message ld-alert"
        oAlert.innerHTML = `<i class="iconfont icon-jinggao"></i><span></span>`
        oAlert.children[1].innerText = text
        setTimeout(() => {
            oAlert.style.top = '24px'
        }, 50);
        setTimeout(() => {
            oAlert.style.opacity = 0
            document.body.removeChild(oAlert)
        }, 3000);
    },
    error(text) {
        // if (document.querySelector(".ld-message-error"))
        //     return;
        const oError = document.createElement('div')
        document.body.appendChild(oError)
        oError.className = "ld-message ld-error"
        oError.innerHTML = `<i class="iconfont icon-cuowu"></i><span></span>`
        oError.children[1].innerText = text
        setTimeout(() => {
            oError.style.top = '24px'
        }, 50);
        setTimeout(() => {
            oError.style.opacity = 0
            document.body.removeChild(oError)
        }, 3000);
    }
}